package teach;

import java.nio.charset.StandardCharsets;

public class UTF8Demo {
    public static void main(String[] args) {
        String str = "Javaλ表达式";
        byte[] data = str.getBytes(StandardCharsets.UTF_8);

        String s = new String(data,StandardCharsets.UTF_8);
        System.out.println(s);

        for(int i=0;i<str.length();i++){
            char c = str.charAt(i);
            System.out.print(c);
            System.out.print(":");
            System.out.println(Integer.toBinaryString(c));
        }

        for(byte b : data){
            System.out.println(Integer.toBinaryString(b & 0xff));
        }

    }
}
